<?php
namespace facade;

protected $bind = [];

abstract Class Facade {

	static abstract function getFacedeName();

	public static function getClass()
	{
		return __CLASS__;
	}

	public static function getFuncArgs()
	{
		return func_get_args();
	}

	// 返回一个实例，通过传入类名，经过反射类实例化
	public static function createFacade()
	{
		$className = static::class;

		if (static::getFacedeName()) {
			$className = static::getFacedeName();
		}

		$className = "framework\\".$className;

		if (!class_exists($className)) {
			throw new Exception(422, "{$className}不存在！");
		}

		return new $className;
	}


	public static function __CallStatic($method, $args)
	{
		return call_user_func_array([static::createFacade(), $method], $args);

		// return static::getFacedeName();

		// var_dump($method);
		// var_dump($args);
	}


}


?>